class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        vector<int> ret;
        int left = 0;
        int right = price.size() - 1;
        while (left < right)
        {
            if (price[left] + price[right] < target)
            {
                left++;
            }
            else if (price[left] + price[right] > target)
            {
                right--;
            }
            else {
                break;
            }
        }
        ret.push_back(price[left]);
        ret.push_back(price[right]);
        return ret;
    }
};